# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Nicolas Lorin <androw95220@gmail.com>
# Maintainer:
pkgname=dxvk
pkgver=1.10.1
pkgrel=0
pkgdesc="Vulkan-based compatibility layer for Direct3D 10/11"
options="!check"
url="https://github.com/doitsujin/dxvk"
arch="x86_64 x86"
license="Zlib"
depends="bash wine"
makedepends="
	meson
	glslang-dev
	mingw-w64-gcc
	wine-dev
	vulkan-loader
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/doitsujin/dxvk/archive/v$pkgver.tar.gz"

case "$CARCH" in
	x86_64)
		_outdir=build/x64
		_crossfile=build-win64.txt
		_prefix=/usr/share/dxvk/x64
		;;
	x86)
		_outdir=build/x32
		_crossfile=build-win32.txt
		_prefix=/usr/share/dxvk/x32
		;;
esac

build() {
	abuild-meson \
		--cross-file=$_crossfile \
		--prefix=$_prefix \
		--bindir="" \
		--libdir="" \
		--datadir="" \
		--includedir="" \
		--infodir="" \
		--libexecdir="" \
		--localedir="" \
		--mandir="" \
		--sbindir="" \
		-Denable_tests=false \
		$_outdir
	meson compile ${JOBS:+-j ${JOBS}} -C $_outdir
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C $_outdir
	install -Dm644 setup_dxvk.sh "$pkgdir"/usr/share/dxvk/setup_dxvk.sh
	mkdir -p "$pkgdir"/usr/bin
	ln -s /usr/share/dxvk/setup_dxvk.sh "$pkgdir"/usr/bin/setup_dxvk
	chmod +x "$pkgdir"/usr/share/dxvk/setup_dxvk.sh
}
sha512sums="
8fd34d9f14a7013cdc1957f63bf60feb19748fddc1cd6ec40cf271005f636de62965efb42ddf2598dad3e37a4f59a870bf769387b2534db93451d1ea6aa65410  dxvk-1.10.1.tar.gz
"
